﻿<Page
    x:Name="pageRoot"
    x:Class="Animation.IntroductionPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Animation"
    xmlns:common="using:Animation.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:bam="using:Brain.Animate"
    mc:Ignorable="d">
    
    <Page.Resources>
        <bam:LightSpeedInRightAnimation x:Key="LightSpeedInRightAnimation" Delay="0.6"/>
        <bam:FloatAnimation x:Key="FloatAnimation"/>
    </Page.Resources>

    <Grid Background="{StaticResource YellowBrush}" >
        
        <bam:AnimationTrigger.Open>
            <bam:FadeInAnimation/>
        </bam:AnimationTrigger.Open>
        
        <bam:AnimationTrigger.Close>
            <bam:FadeOutAnimation Duration="1.2"/>
        </bam:AnimationTrigger.Close>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                        Style="{StaticResource NavigationBackButtonNormalStyle}"
                        VerticalAlignment="Top"
                        AutomationProperties.Name="Back"
                        AutomationProperties.AutomationId="BackButton"
                        AutomationProperties.ItemType="Navigation Button"
                    >
                    <bam:AnimationTrigger.Open> 
                        <bam:BounceInRightAnimation/> 
                    </bam:AnimationTrigger.Open>
                
                    <bam:AnimationTrigger.Close> 
                        <bam:BounceOutLeftAnimation/> 
                    </bam:AnimationTrigger.Close>
                </Button>
        </Grid>

        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.RowSpan="2" >
            <bam:AnimatedImage x:Name="AnimatedImage" 
                Width="100" Height="150" 
                SpriteWidth="82" SpriteHeight="150" 
                SpriteSheetSource="/Images/WalkingSpriteSheet.png" 
                SpriteCountX="8" SpriteIndex="0" 
                FrameTimeSpan="00:00:00.2" IsAnimating="True"
            >
                <bam:AnimationTrigger.Open>
                    <bam:FadeInRightAnimation Delay="0.6" Duration="1.2"/>
                </bam:AnimationTrigger.Open>
                <bam:AnimationTrigger.Close>
                    <bam:FadeOutRightAnimation/>
                </bam:AnimationTrigger.Close>
            </bam:AnimatedImage>

            <TextBlock x:Name="pageTitle" Text="Animation Manager" 
                       Foreground="{StaticResource OrangeBrush}" Style="{StaticResource HeaderTextBlockStyle}" >
                <bam:AnimationTrigger.Open> 
                    <bam:BounceInDownAnimation/> 
                </bam:AnimationTrigger.Open>
                
                <bam:AnimationTrigger.Close> 
                    <bam:BounceOutUpAnimation/> 
                </bam:AnimationTrigger.Close>
            </TextBlock>


            <Button x:Name="HelloButton" Content="Showcase" 
                    FontSize="50" Margin="25" 
                    HorizontalAlignment="Center"
                    Click="HelloButton_OnClick" 
                    Foreground="{StaticResource DarkGreyBrush}" BorderBrush="{StaticResource DarkGreyBrush}" 
                    >
                <bam:AnimationTrigger.Open>
                    <bam:BounceInUpAnimation Delay="0.3"/>
                </bam:AnimationTrigger.Open>

                <bam:AnimationTrigger.Idle>
                    <bam:PulseAnimation Duration="4.0"/>
                </bam:AnimationTrigger.Idle>
            </Button>

            <Button x:Name="ExperimentsButton" Content="experiments" 
                    FontSize="36" 
                    HorizontalAlignment="Center"
                    Click="ExperimentsButton_OnClick" 
                    Foreground="{StaticResource DarkGreyBrush}" BorderBrush="{StaticResource DarkGreyBrush}" Width="220" 
             >
                <bam:AnimationTrigger.Open>
                    <bam:BounceInUpAnimation Delay="0.5"/>
                </bam:AnimationTrigger.Open>
            </Button>
        </StackPanel>
        <TextBlock Text="Sponsored by: BrainOffline" 
                   x:Name="SponsorText" Grid.Row="1"
                   HorizontalAlignment="Center" VerticalAlignment="Bottom" 
                   Margin="12" 
                   Foreground="{StaticResource RedBrush}" Style="{StaticResource SubtitleTextBlockStyle}"
                   
                   bam:AnimationTrigger.Open="{StaticResource LightSpeedInRightAnimation}"                   
                   bam:AnimationTrigger.Idle="{StaticResource FloatAnimation}"
                   >
        </TextBlock>

    </Grid>
</Page>
